﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TVL03
    {
       
        public TVL03()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            MV = new VVERSART();
            this.DataContext = MV; 
            InitializeComponent();
         }
        public override void LOADBYAUF()
        {
            if (ORDERNUM.Length < 6)
                return;
            dwData = TBMain.NewRow();
            dwData["VMANDANT"] = app.Mandant;
            dwData["VVERSART"] = ORDERNUM.Substring(0,3);
            dwData["VSPED"] = ORDERNUM.Substring(3, 3);
            SResult = ((VVERSART)MV).QueryVERSART(dwData, 1);
            MergeData(SResult, true);
            base.LOADBYAUF();
        }
        public override void OnSave()
        {
            if (!IsSaved)
                return;
            if (dwMaster == null)
                return;
            TMV.UpdateVERSART(dwMaster, app.company, 0);
            KEY = "";
            KEY = dwMaster["VVERSART"].ToString() + dwMaster["VSPED"].ToString();
            base.OnSave();
        }
    }
}
